package 线程状态;

/**
 * @Author: 李佳芬
 * @Description: 线程插队，插队后执行完才会执行被插队的线程
 * @DateTime: 2023/3/31 17:15
 **/
public class TestJoin implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("我是插队的VIP线程"+"===="+i);
        }
    }

    public static void main(String[] args) throws InterruptedException {
        TestJoin testJoin = new TestJoin();
        Thread thread = new Thread(testJoin);
        thread.start();
        for (int i = 0; i < 1000; i++) {
            if (i==300){
                thread.join();
            }
            System.out.println("我是Main"+"==="+i);
        }

    }
}
